package com.mt.mtbusinessmanagementsystem.utils.product.level;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Builder
@Repository
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class SecondLevel implements ProductClassLevel{
    private Integer secondClassificationId;
    private String secondClassificationName;
    private List<ThirdLevel> dataList;

    public static SecondLevel fromProductClassLevel(ProductClassLevel productClassLevel) {
        if (productClassLevel instanceof SecondLevel) {
            return (SecondLevel) productClassLevel;
        } else {
            throw new IllegalArgumentException("不能转换为SecondLevel类");
        }
    }

}
